package generic_test;

public class Point {
    private Object x;
    private Object y;


    public void setX(Object x) {
        this.x = x;
    }

    public void setY(Object y) {
        this.y = y;
    }

    public Object getX() {
        return x;
    }

    public Object getY() {
        return y;
    }

    public static void main(String[] args) {
//        Point point1 = new Point();
//        point1.setX(10);
//        point1.setY(20);
//        int x =(int) point1.getX();
//        int y =(int) point1.getY();
//        System.out.println("x = "+x+", y = "+y);
//      要求此时X和Y必须是相同类型的，设置由用户设置的
//        Point point1 = new Point();
//        point1.setX("东经20度");
//        point1.setY("北纬20度");
//        String x = (String) point1.getX();
//        String y = (String) point1.getY();
//        System.out.println("x = "+x+", y = "+y);

        Point point=new Point();
        point.setX(10);
        point.setY("北纬30度");
        String x=(String) point.getX();
        String y=(String) point.getY();

    }
}
